package com.peak.controller;

import com.peak.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Slf4j
public class TestController {

    @Autowired
    private TestService testService;

    /**
     * 正常调用接口
     */
    @PostMapping("/test1")
    public void test1(@RequestBody Map<String, Object> params){
        testService.business(params);
    }

    /**
     * 通过消息中间件调用接口
     */
    @PostMapping("/test2")
    public void test2(@RequestBody Map<String, Object> params){
        testService.convertAndSend("geo-exchange", "geo.key.inout", params);
    }

}
